<% content_for :right do %>

<% unless @forum.description.blank? %>
<%= @forum.description_html %>
<hr />
<% end %>

<h5 style="margin-bottom:1.0em;"><%= _('Moderators') %></h5>

<% if @forum.moderators.any? -%>
<ul class="flat" style="margin-top:1em;">
<% @forum.moderators.each do |user| -%>
  <li><%= link_to user.display_name, user_path(user) %></li>
<% end -%>
</ul>
<% else -%>
<p><%= _('This forum is currently unmoderated.') %></p>
<p><%= _('Please always be courteous.') %></p>
<% end -%>

<% end %>

<% @page_title = @forum.name %>

<div class="crumbs">
<%= link_to _('Ruby on Rails Chinese Community'), home_path %> <span class="arrow">&rarr;</span>
</div>
<h1 style="margin-top:0.5em">
  <%= h @forum.name %>
</h1>

<p class="subtitle">
  <%= feed_icon_tag @forum.name, formatted_forum_posts_path(@forum, :rss) %> 
  <%= "#{@forum.topics_count} " +_('topic') %>, <%=  "#{@forum.posts_count} "+ _('posts') %>
</p>



<% if @topic_pages.page_count > 1 -%>
<% if logged_in? %>
<p style="float:right; margin-top:0;"><%= link_to _('New topic'), new_topic_path(@forum), :class => "utility" %></p>
<% end %>
<p class="pages"><%= _('Pages:') %> <strong><%= pagination_links @topic_pages, :window_size => 10 %></strong></p>
<% end -%>

<table border="0" cellspacing="0" cellpadding="0" class="wide topics">
<tr>
  <th class="la" colspan="2"><%= _('Topic') %></th>
  <th width="5%"><%= _('Post') %></th>
  <th width="5%"><%= _('Views') %></th>
  <th class="la"><%= _('Last post') %></th>
</tr>
<% for topic in @topics %>
<tr class="hentry">
  <td style="padding:5px; width:16px;" class="c1">
    <% 
    icon = "comment"
    color = ""
    if topic.locked?
      icon = "lock"
      post = ", this topic is locked."
      color = "darkgrey"
    end
    %>
    <% if recent_topic_activity(topic) %>
    <%= image_tag "clearbits/#{icon}.gif", :class => "icon green", :title => "Recent activity#{post}" %>
    <% else %>
      <%= image_tag "clearbits/#{icon}.gif", :class => "icon grey #{color}", :title => "No recent activity#{post}" %>
    <% end %>
  </td>
  <td class="c2">
    <%= _("Sticky:") +"#{"<strong>"}" if topic.sticky? %>
    <%= topic_title_link (topic), :class => "entry-title", :rel => "bookmark" %>
    <%#= link_to h(topic.title), topic_path(@forum, topic), :class => "entry-title", :rel => "bookmark" %>
    <%= "</strong>" if topic.sticky? %>
    <% if topic.paged? -%>
    <small><%=link_to _('last'), topic_path(:forum_id => @forum, :id => topic, :page => topic.last_page) %></small>
    <% end -%>
  </td>
  <td class="ca inv stat"><%= topic.posts_count-1 %></td>
  <td class="ca inv stat"><%= number_with_delimiter(topic.views) %></td>
  <td class="lp">
    <abbr class="updated" title="<%= topic.replied_at.xmlschema %>"><%= time_ago_in_words(topic.replied_at) %></abbr>
    by <span class="author"><strong class="fn"><%= h(topic.replied_by_user.display_name) %></strong></span>
    <span><%= link_to _('view'), topic_path(:forum_id => @forum, :id => topic, :page => topic.last_page, :anchor => "posts-#{topic.last_post_id}") %></span>
  </td>
</tr>
<% end %>
</table>

<% if @topic_pages and @topic_pages.current.next %>
<p style="float:right;"><%= link_to _('Next page'), { :page => @topic_pages.current.next }.merge(params.reject{|k,v| k=="page"})  %></p>
<% end %>

<% if @topic_pages.page_count > 1 -%>
<p class="pages"><%= _('Pages:') %> <strong><%= pagination_links @topic_pages, :window_size => 10 %></strong></p>
<% end -%>

<% if logged_in? %>
<p><%= link_to _('New topic'), new_topic_path(@forum), :class => "utility" %></p>
<% end%>
